package 定长滑动窗口

func numOfSubarrays(arr []int, k int, threshold int) (count int) {
	sum := 0
	//进
	for i, in := range arr {
		left := i - k + 1

		sum += in
		if left < 0 {
			//在窗口未填满时，只做 “加入元素” 的操作；窗口填满后，才开始 “更新结果 + 滑动窗口”
			continue
		}

		//更
		if (sum / k) >= threshold {
			count++
		}
		//出
		sum -= arr[left]
	}
	return
}
